package taladro.vista.proyecto;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

public class PanelProySel extends JPanel
{

    public JDialog dialog;
    public boolean aceptar;
    public boolean archDrill;
    private ButtonGroup buttonGroup1;
    private JButton jButton1;
    private JButton jButton2;
    private JLabel jLabel1;
    private JPanel jPanel1;
    private JPanel jPanel2;
    private JRadioButton jRadioDrill;
    private JRadioButton jRadioGerber;

    public PanelProySel()
    {
        aceptar = false;
        archDrill = false;
        initComponents();
    }

    private void initComponents()
    {
        buttonGroup1 = new ButtonGroup();
        jLabel1 = new JLabel();
        jPanel1 = new JPanel();
        jRadioDrill = new JRadioButton();
        jRadioGerber = new JRadioButton();
        jPanel2 = new JPanel();
        jButton1 = new JButton();
        jButton2 = new JButton();
        setLayout(new GridLayout(3, 0));
        jLabel1.setText("Indique el tipo del archivo seleccionado");
        add(jLabel1);
        jPanel1.setLayout(new GridBagLayout());
        buttonGroup1.add(jRadioDrill);
        jRadioDrill.setMnemonic('a');
        jRadioDrill.setSelected(true);
        jRadioDrill.setText("Archivo DRILL");
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = 17;
        jPanel1.add(jRadioDrill, gridBagConstraints);
        buttonGroup1.add(jRadioGerber);
        jRadioGerber.setMnemonic('a');
        jRadioGerber.setText("Archivo Gerber rs274x format");
        gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        jPanel1.add(jRadioGerber, gridBagConstraints);
        add(jPanel1);
        jButton1.setLabel("Aceptar");
        
        
        jButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt)
            {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel2.add(jButton1);
        jButton2.setLabel("Cancelar");
        jButton2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt)
            {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel2.add(jButton2);
        add(jPanel2);
    }

    private void jButton2ActionPerformed(ActionEvent evt)
    {
        aceptar = false;
        dialog.dispose();
    }

    private void jButton1ActionPerformed(ActionEvent evt)
    {
        aceptar = true;
        if(jRadioDrill.isSelected())
        {
            archDrill = true;
        } else
        {
            archDrill = false;
        }
        dialog.dispose();
    }


}
